#pragma once

#include <memory>
#include "instructions/base/instructions.h"
#include "rtda/frame.h"
#include "rtda/thread.h"
#include "rtda/heap/object.h"

namespace jvm {
    namespace instructions {

        class ATHROW : public NoOperandsInstruction {
        public:
            void execute(std::shared_ptr<rtda::Frame> pFrame) override;
        };

        bool findAndGotoExceptionHandler(std::shared_ptr<rtda::Thread> pThread,
            heap::ObjectPtr pEx);

        void handleUncaughtException(std::shared_ptr<rtda::Thread> pThread,
            heap::ObjectPtr pEx);

    } // namespace instructions
} // namespace jvm